#include<iostream>
#include "EquationSolver.h"
#include <cmath>  
using namespace std;

// D.1
class Func1 : public Function{
    public:
        virtual double operator()(const double &x){
            return sin(x/2)-1;
        }
}func1;

// D.2
class Func2 : public Function{
    public:
        virtual double operator()(const double &x){
            return exp(x) - tan(x);
        }
}func2;

// D.3
class Func3 : public Function{
    public:
        virtual double operator()(const double &x){
            return x*x*x - 12*x*x + 3*x + 1;
        }
}func3;

int main(){
    cout << "D.1 : "<< endl;
    SecantSolver(func1, 0, -0.5, eps, 100).solve();
    cout << "D.2 : "<< endl;
    SecantSolver(func2, 1, 1.4, eps, 100).solve();
    cout << "D.3 : "<< endl;
    SecantSolver(func3, 0, -0.5, eps, 100).solve();
}